﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ServerSocketTest
{
    public partial class ServerControlMainForm : Form
    {
        ServerSocket gServerSocket;
        public ServerControlMainForm()
        {
            InitializeComponent();
            gServerSocket = new ServerSocket(80,10);
        }

        private void Clear_Message_button_Click(object sender, EventArgs e)
        {
            InformationControl.MsgClear(Inform_richTextBox);
        }

        private void Test_button_Click(object sender, EventArgs e)
        {
            InformationControl.Messages(Inform_richTextBox, InformationControl.MsgType.Incoming, "test======"+Environment.NewLine);
        }

        private void informMessage(string infor)
        {
            InformationControl.Messages(Inform_richTextBox, InformationControl.MsgType.Incoming, infor + Environment.NewLine);
        }
        private void StartServer_button_Click(object sender, EventArgs e)
        {
            //gServerSocket = new ServerSocket(80);
            //gServerSocket.StartListening();
            gServerSocket.Start();
            gServerSocket.SetInformLoger(informMessage);
            Send_button.Enabled = true;
        }

        private void Send_button_Click(object sender, EventArgs e)
        {
            //gServerSocket.Send(
        }

        private void Stop_button_Click(object sender, EventArgs e)
        {
            Send_button.Enabled = false;
            gServerSocket.Stop();
        }
    }
}
